package Deom7;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 周斌
 * Date: 2023-11-19
 * Time: 22:09
 */
public class Animal {
    public String name;
    public Animal(String name) {
        this.name = name;
    }
    public void eat() {
        System.out.println(this.name+"吃东西");
    }
    public void sleep() {
        System.out.println(this.name+"在睡觉");
    }
}
class Dog extends Animal {

    public Dog(String name) {
        super(name);
    }

    @Override
    public void eat() {
        System.out.println(this.name+"在吃狗粮");
    }

    @Override
    public void sleep() {
        System.out.println(this.name+"在狗窝睡觉");
    }
}
class Cat extends Animal {

    public Cat(String name) {
        super(name);
    }

    @Override
    public void eat() {
        System.out.println(this.name+"在吃猫粮");
    }

    @Override
    public void sleep() {
        System.out.println(this.name+"在猫窝睡觉");
    }
}

